//Step 3: Controller
package controller;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import service.SystemService;
import controller.SystemForm;


@Controller("SystemController")
@RequestMapping("add.htm")
public class SystemController {
		//@Autowired
		private SystemService systemService;	
		
		@RequestMapping(method = RequestMethod.POST)
		public String processForm(SystemForm form, BindingResult result, Map <String, Object> model){
		model.put("system1", form.getSystem1());
		model.put("system2", form.getSystem2());
		model.put("system3", form.getSystem3());
		model.put("system4", form.getSystem4());
		model.put("system5", form.getSystem5());
		model.put("system6", form.getSystem6());
		model.put("system7", form.getSystem7());
		model.put("system8", form.getSystem8());
		model.put("system9", form.getSystem9());
		model.put("system10", form.getSystem10());
		
		//access the service
		systemService = new SystemService(form);
				
		//redirect the user back to the page which shows what they entered on their form page.
		return "success";
		
		 
			
			
		}
						
}

	

